package com.ruoyi.common.utils;

import java.util.UUID;

/**
 * Created by GaoXiang
 */
public class UUIDFactory {

    /**
     * 生成一个Long类型的id
     * @return
     */
    public static String getStringId(){

        Long random = UUID.randomUUID().getMostSignificantBits();
        Long id = Math.abs(random);
        return id.toString();
    }

    public static void main(String[] args) {

//        for(int i = 0;i < 1000;i++ ){
//            String id = getStringId();
//            System.out.println(id);
//        }
        System.out.println(getStrTime("20190228074512"));

    }

    /**
     * 20190228074512
     * @param strTime
     * @return
     */
    public static String getStrTime(String  strTime){
        if(strTime.length() ==14){
            String year =strTime.substring(0,4);
            String month = strTime.substring(4,6);
            String day = strTime.substring(6,8);
            String  hour = strTime.substring(8,10);
            String  mint = strTime.substring(10,12);
            String  m = strTime.substring(12,14);
            return    year+"/"+month+"/"+day+"  "+hour+":"+mint+":"+m;
        }else{
            return "";
        }
    }
}
